#include <iostream>
using namespace std;

int main()
{
    int length;
    char c;
    cin >> length >> c;
    string input;
    cin.get();
    getline(cin, input);
    if (input.length() > length)
    {
        input.erase(0, input.length() - length);
        cout << input;
    }
    else
    {
        int n = length - input.length();
        string s = "";
        for (int i = 0; i < n; i++)
        {
            s += c;
        }
        s += input;
        cout << s;
    }
    return 0;
}